{extend name="public/base" /}
{block name="css"}
<link rel="stylesheet" href="__INDEX__/css/create.css">
{/block}
{block name="container"}
<div class="panel-body panel-body-nopadding">
    <div class="inforMain">基本信息</div>
    <div class="tishiform"></div>
    <form class="form-horizontal form-bordered" id="submitForm" action="" method="post" > 
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>客户名称：</label>
            <div class="col-sm-2">
                <input type="text" class="form-control" placeholder="客户名称" name="cust[name]" value="{$data['name'] ?? ''}"  required>
            </div>
			<label class="col-sm-1 control-label"><span>*</span>联系电话：</label>
            <div class="col-sm-3" >
                <input type="text" class="form-control" placeholder="联系电话" name="cust[phone]" value="{$data['phone'] ?? ''}"  required>
            </div>
        </div>
      
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>性&emsp;&emsp;别：</label>
            <div class="col-sm-2" >
                <input type="radio" value="1" {if condition="$data['sex'] eq 1"} checked="checked"{/if} name="cust[sex]" style="margin-top: 10px;margin-right: 8px;">男 
                <input type="radio" value="2" name="cust[sex]" {if condition="$data['sex'] eq 2"} checked="checked"{/if} style="margin-left:30px;margin-top: 10px;margin-right: 8px">女
            </div>
            <label class="col-sm-1 control-label"><span>*</span>年&emsp;&emsp;龄：</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" placeholder="年龄" name="cust[age]" value="{$data['age'] ?? ''}"  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>收货地址：</label>
            <div class="col-sm-2">
                <select   name="cust[province]" class="form-control" id="province" onchange="getRegion(this.value,1)">
                    <option value="-1">省份</option>
                    {volist name="prov" id="pvo"}
                    <option value="{$pvo.code}" {if condition="$data['province'] eq $pvo['code']"} selected="selected"{/if}>{$pvo.name}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-sm-2">
                <select  name="cust[city]" id="city" class="form-control" onchange="getRegion(this.value,2)">
                    <option value="-1">城市</option>
                    {volist name="city" id="ci"}
                        <option value="{$ci.code}" {if condition="$data['city'] eq $ci['code']"} selected="selected" {/if}>{$ci.name}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-sm-2">
                <select name="cust[area]" class="form-control" id="area">
                    <option value="-1">县/区</option>
                    {volist name="area" id="ai"}
                        <option value="{$ai.code}" {if condition="$data['area'] eq $ai['code']"} selected="selected" {/if}>{$ai.name}</option>
                    {/volist}
                </select>
            </div>
       </div>
	   <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>详细地址：</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" placeholder="详细地址" name="cust[address]" value="{$data['address'] ?? ''}"  required>
            </div>
        </div>
       <div class="form-group">
        <label class="col-sm-1 control-label"><span>*</span>店&emsp;&emsp;铺：</label>
        <div class="col-sm-2">
            <select name="shop_id" class="form-control" id="shop_id" onchange="getInfo(this.value)">
                <option value="-1">店铺</option>
                {volist name="shop" id="v"}
                <option value="{$v.id}" {if condition="$data['shop_id'] eq $v['id']"} selected="selected"{/if}>{$v.title}</option>
                {/volist}
            </select>
        </div>
        <div class="col-sm-1">
            <select name="user_id" class="form-control" id="user_id">
                <option value="">姓名</option>
                {volist name="user" id="us"}
                <option value="{$us.id}" {if condition="$data['user_id'] eq $us.id"} selected="selected"{/if}>{$us.truename}</option>
                {/volist}
            </select>
        </div>
        <label class="col-sm-1 control-label"><span>*</span>等&emsp;&emsp;级：</label>
                <div class="col-sm-2">
            <select name="cust[level]" class="form-control" id="level">
                <option value="-1">------等级------</option>
                {volist name="level" id="vo"}
                <option value="{$vo.id}" {if condition="$data['level'] eq $vo['id']"} selected="selected"{/if}>{$vo.title}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label"><span>*</span>客户来源：</label>
        <div class="col-sm-11" >
            <input type="radio" value="1" name="cust[from]" {if condition="$data['from'] eq 1"} checked="checked" {/if} style="margin-top: 10px;margin-right: 8px;">个人查找
            <input type="radio" vaule="2" name="cust[from]"  {if condition="$data['from'] eq 2"} checked="checked" {/if} style="margin-left:30px;margin-top: 10px;margin-right: 8px">老客户介绍
            <input type="radio" vaule="3" name="cust[from]"  {if condition="$data['from'] eq 3"} checked="checked" {/if} style="margin-left:30px;margin-top: 10px;margin-right: 8px">公司派单
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label"><span>*</span>新老客户：</label>
        <div class="col-sm-11" >
            <input type="radio" value="1" name="cust[is_New]" {if condition="$data['is_New'] eq 1"} checked="checked" {/if} style="margin-top: 10px;margin-right: 8px;">新客户
            <input type="radio" value="0" name="cust[is_New]" {if condition="$data['is_New'] eq 0"} checked="checked" {/if} style="margin-left:30px;margin-top: 10px;margin-right: 8px">老客户
        </div>
    </div>
    <div class="inforliang">量体信息</div>
    <div class="form-group">
        <label class="col-sm-12 control-label" style="background: #7F7F7F;text-align: center;color: #000;">量体信息</label>
        <div  >
            <table class="table ">
               <tr >
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000;">部位</th>
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
                 
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">部位</th>
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
                   
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">部位</th>
                   <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
               </tr>
               <tr  >
                   <td >1.身高</td>
                   <td><input type="text" name="jing[height]" class="form-control" value="{$data['first']['height'] ?? ''}" required></td>
                   <td>16.右袖长</td>
                   <td><input type="text" name="jing[right_sleeve]" value="{$data['first']['right_sleeve'] ?? ''}" class="form-control" required></td>
                   <td colspan="2">肩型</td> 
               </tr>
               <tr>
                 <td >2.体重</td>
                 <td><input type="text" name="jing[weight]" value="{$data['first']['weight'] ?? ''}" class="form-control" required></td>
                 <td>17.后腰节</td>
                 <td><input type="text" name="jing[b_lumbar]" value="{$data['first']['b_lumbar'] ?? ''}" class="form-control" required></td>
                 <td colspan="2">
                    左：<input type="text" style="display: inline-block;width: 25px" value="{$data['first']['st_left'] ?? ''}" name="jing[st_left]"  required>
                    右：<input type="text" style="display: inline-block;width: 25px" value="{$data['first']['st_right'] ?? ''}" name="jing[st_right]" required> 
                </td>   
            </tr>
            <tr>
             <td >3.领围</td>
             <td><input type="text" name="jing[neck]" value="{$data['first']['neck'] ?? ''}" class="form-control" required></td>
             <td>18.后衣长</td>
             <td><input type="text" name="jing[b_coat]" value="{$data['first']['b_coat'] ?? ''}" class="form-control" required></td>
             <td colspan="2">肚型</td>   
         </tr>
         <tr>
             <td >4.胸围</td>
             <td><input type="text" name="jing[bust]" value="{$data['first']['bust'] ?? ''}" class="form-control" required></td>
             <td>19.后腰高</td>
             <td><input type="text" name="jing[bl_height]" value="{$data['first']['bl_height'] ?? ''}" class="form-control" required></td>
             <td colspan="2">
                <input type="radio" name="jing[belly]" {if condition="$data['first']['belly'] eq 1"} checked="checked" {/if} value="1" style="width: auto;">正常
                <input type="radio" name="jing[belly]" {if condition="$data['first']['belly'] eq 2"} checked="checked" {/if} value="2" style="width: auto;">凸肚
            </td>   
        </tr>
        <tr>
         <td >5.中腰围</td>
         <td><input type="text" name="jing[middle_waist]" value="{$data['first']['middle_waist'] ?? ''}" class="form-control" required></td>
         <td>20.前腰节</td>
         <td><input type="text" name="jing[a_lumbar]" value="{$data['first']['a_lumbar'] ?? ''}" class="form-control" required></td>
         <td colspan="2">臂型</td>   
     </tr>
     <tr>
         <td >6.裤腰围</td>
         <td><input type="text" name="jing[pants_waist]" value="{$data['first']['pants_waist'] ?? ''}" class="form-control" required></td>
         <td>21.前腰高</td>
         <td><input type="text" name="jing[al_height]" value="{$data['first']['al_height'] ?? ''}" class="form-control" required></td>
         <td colspan="2">
            <input type="radio" name="jing[arm]" {if condition="$data['first']['arm'] eq 1"} checked="checked" {/if} value="1" style="width: auto;">正常
            <input type="radio" name="jing[arm]" {if condition="$data['first']['arm'] eq 2"} checked="checked" {/if} value="2" style="width: auto;">手臂靠后
        </td>   
    </tr>
    <tr>
     <td >7.臀围</td>
     <td><input type="text" name="jing[hipline]" value="{$data['first']['hipline'] ?? ''}" class="form-control" required></td>
     <td>22.裤长</td>
     <td><input type="text" name="jing[trousers]" value="{$data['first']['trousers'] ?? ''}" class="form-control" required></td>
     <td colspan="2">臀型</td>   
 </tr>
 <tr>
     <td >8.腿根围</td>
     <td><input type="text" name="jing[leg_size]" value="{$data['first']['leg_size'] ?? ''}" class="form-control" required></td>
     <td>23.腰膝长</td>
     <td><input type="text" name="jing[wk_length]" value="{$data['first']['wk_length'] ?? ''}" class="form-control" required></td>
     <td colspan="2">
        <input type="radio" name="jing[buttocks]" value="1" {if condition="$data['first']['buttocks'] eq 1"} checked="checked" {/if} style="width: auto;">正常
        <input type="radio" name="jing[buttocks]" value="2" {if condition="$data['first']['buttocks'] eq 2"} checked="checked" {/if} style="width: auto;">翘臀
        <input type="radio" name="jing[buttocks]" value="3" {if condition="$data['first']['buttocks'] eq 3"} checked="checked" {/if} style="width: auto;">坠臀
    </td>   
</tr>
<tr>
 <td >9.通档</td>
 <td><input type="text" name="jing[tongdang]" value="{$data['first']['tongdang'] ?? ''}" class="form-control" required></td>
 <td>24.膝长</td>
 <td><input type="text" name="jing[knee]" value="{$data['first']['knee'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>
<tr>
 <td >10.上臂围</td>
 <td><input type="text" name="jing[upper_arm]" value="{$data['first']['upper_arm'] ?? ''}" class="form-control" required></td>
 <td>25.腿肚围</td>
 <td><input type="text" name="jing[calf_length]" value="{$data['first']['calf_length'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>
<tr>
 <td >11.左腕围</td>
 <td><input type="text" name="jing[left_wrist]" value="{$data['first']['left_wrist'] ?? ''}" class="form-control" required></td>
 <td>26.脚口</td>
 <td><input type="text" name="jing[foot]" value="{$data['first']['foot'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>
<tr>
 <td >12.右腕围</td>
 <td><input type="text" name="jing[right_wrist]" value="{$data['first']['right_wrist'] ?? ''}" class="form-control" required></td>
 <td>27.胸高</td>
 <td><input type="text" name="jing[th_height]" value="{$data['first']['th_height'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr
<tr>
 <td >13.总肩宽</td>
 <td><input type="text" name="jing[shoulder]" value="{$data['first']['shoulder'] ?? ''}" class="form-control" required></td>
 <td>28.胸距</td>
 <td><input type="text" name="jing[th_distance]" value="{$data['first']['th_distance'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>
<tr>
 <td >14.前肩宽</td>
 <td><input type="text" name="jing[front_shoulder]" value="{$data['first']['front_shoulder'] ?? ''}" class="form-control" required></td>
 <td>29.前胸宽</td>
 <td><input type="text" name="jing[across_front]" value="{$data['first']['across_front'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>
<tr>
 <td >15.左袖长</td>
 <td><input type="text" name="jing[left_sleeve]"  value="{$data['first']['left_sleeve'] ?? ''}" class="form-control" required></td>
 <td>30.后背宽</td>
 <td><input type="text" name="jing[across_back]" value="{$data['first']['across_back'] ?? ''}" class="form-control" required></td>
 <td colspan="2"></td>   
</tr>


</table>
</div>  
</div>
</div>
<div class="panel-footer">
  <div class="row">
     <div class="col-sm-6 col-sm-offset-3">
       <input type="hidden" name="id" value="{$data['id'] ?? ''}">
      <!--  <button type="submit" class="btn btn-primary" style="display: block;margin:0 auto">提交</button> -->
        <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);" style="margin:0 auto">返回</button> 
   </div>
</div>
</div><!-- panel-footer --> 
</form>
</div>
{/block}
{block name="js"}
<script>
    function getRegion(val,level)
    {
      var $city = $("#city");
      var $area = $("#area");
       if(level=='1'){
                    $city.html('<option value=""> --请选择市-- </option>');
                    $city.val('');
                }
                $area.html('<option value=""> --请选择区-- </option>');
                $area.val('');
      $.post('{:url('index/common/getRegion')}', { pcode: val,level:level}, function(data) {
               var dataObj=eval("("+data+")");//转换为json对象   
               if(dataObj['code']==1){
                if(level=='1'){
                    $.each(dataObj['list'], function(i, item) {
                      $city.append('<option value="'+item['code']+'">'+item['name']+'</option>');
                  });
                }else{
                    $.each(dataObj['list'], function(i, item) {
                      $area.append('<option value="'+item['code']+'">'+item['name']+'</option>');
                  });
                }
            }
        });
  }
</script>
<script>
    function getInfo(val)
    {
        var $user_id = $('#user_id');
         $user_id.html('<option value=""> --姓名-- </option>');
                    $user_id.val('');
        $.post('{:url('index/common/getInfo')}', {id: val}, function(data) {
           var dataObj=eval("("+data+")");//转换为json对象  
           if(dataObj['code'] == 1){
               $.each(dataObj['list'], function(i, item) {
                  $user_id.append('<option value="'+item['id']+'">'+item['truename']+'</option>');
              });
           }
       });
    }
</script>
{/block}